package com.zykj.iterator;

import java.util.Iterator;

/**
 * @author zhoulj(周利军) [1217102780@qq.com]
 * @Title: Fuwuyuan
 * @Project: ${MODEL_NAME}
 * @Module ID:   <(模块)类编号，可以引用系统设计中的类编号>
 * @Comments: <对此类的描述，可以引用系统设计中的描述>
 * @JDK version used:      <JDK1.8> 36
 * @since 2019/1/7-21:36
 */
public class Fuwuyuan {
    Menu zaocanMenu;
    Menu wucanMenu;
    public Fuwuyuan(Menu zaocanMenu,Menu wucanMenu) {
        this.zaocanMenu = zaocanMenu;
        this.wucanMenu = wucanMenu;
    }

    public void printMenu() {
        Iterator zaocan = zaocanMenu.createIterator();
        Iterator wucan = wucanMenu.createIterator();
        System.out.println("================打印早餐====================");
        printMenu(zaocan);
        System.out.println("================打印午餐====================");
        printMenu(wucan);
    }

    public void printMenu(Iterator iterator) {
        while (iterator.hasNext()) {
            MenuItem menuItem = (MenuItem) iterator.next();
            System.out.println(menuItem.getName()+",   "+ menuItem.getDescription()+",  "+ menuItem.getPrice());
        }
    }
}
